<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of estatisticas
 *
 * @author root
 */
class Estatisticas {
    
    static function acesso_pagina($cod = 0,$tpo = 0){
        
        $front = Zend_Controller_Front::getInstance();
        $session = Zend_Auth::getInstance();
        
        $nao_reg = array('acessopaginas');
        
        if(array_search($front->getRequest()->getControllerName(), $nao_reg) === FALSE){
            $post = '';
            if($front->getRequest()->isPost()){
                foreach($_POST as $key => $value) $post .= '&'.$key.'='.$value; 
            }

            $data = array(
                'ACE_CTL'   => $front->getRequest()->getControllerName(),
                'ACE_ACT'   => $front->getRequest()->getActionName(),
                'ACE_COD'   => $cod,
                'USU_ID'    => $session->getStorage()->read()->USU_ID,
                'ACE_DATHOR'=> date('Y-m-d H:i:s'),
                'ACE_ANO'=> date('Y'),
                'ACE_URL'   => $_SERVER ['REQUEST_URI'],
                'ACE_TPO'   => $tpo,
                'ACE_PST'   => $post,
                'ACE_IP'    => $_SERVER["REMOTE_ADDR"], 
            );

            $db = Zend_Db_Table_Abstract::getDefaultAdapter();
            $db->insert('ACESSO_PAGINAS',$data);
        }
    }
}

?>
